//var u = setInterval(function(){
//获取当前的时间
//    var time = new Date();
//    var hour = time.getHours();
//    var m = time.getMinutes();
//    var s = time.getSeconds();
//
////自定义时间
//    var xs = 20;
//    var f = 60;
//    var ms = 60;
//
////计算相差时间
//    document.querySelector("#shi").innerHTML = xs - hour;
//    document.querySelector("#fen").innerHTML = f - m;
//    document.querySelector("#miao").innerHTML = ms - s;
//
//
//});

var shi = document.querySelector("#shi");
var fen = document.querySelector("#fen");
var miao = document.querySelector("#miao");

//截止时间
var xs = 23;
var f = 59;
var ms = 59;


var a = setInterval(function(){



    //获取当前时间
    var time = new Date();
    var hour = time.getHours();
    var m = time.getMinutes();
    var s = time.getSeconds();

    shi.innerHTML = xs - hour;
    fen.innerHTML = f - m;
    miao.innerHTML = ms - s;

    if(fen.innerHTML < 0 || miao.innerHTML < 0 ){
        clearInterval(a);
        alert("倒计时结束");
        fen.innerHTML = 0;
        miao.innerHTML = 0;
    }
});